package com.zjitc.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id ="2016091400508002";
	
	// 商户私钥，您的PKCS8格式RSA2私钥

    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC99+1oLUWh3Q+nqbgvMUV3l3upIAbPZah8Ye1hBPO9DnbIxe5aQH4WRtwiwB/+F5HpCrtO9m9juciUi9rP3xLK4H0gGbIRVbKsCsvrT3eC8HemIhmZ1q+J34CWyF4fVZH03MPSYSVsh1sFSRUtwM5wkq7/WwZpmpvmASpjiLI13KdoBp+mx6FHnWZwK1i6SjBHTYLzbtbgJLudbArdnxy2zDoxtjdS9InswXjlJybfuU9JKJ/6tHMexRYMHABfaQiWddj9Gwvlo8H5uk+pN+I5rAZ9tdxL2k8g6ZvBf8ZD/60VkGYGOLxwlCaKD4PUkQIGNOqWeAzzSAiEXxiGImPdAgMBAAECggEBAJuHmH9qUVAsRNzoPzukA1PeWggliG3UtRTguBBulX97kBTguDx8AL8MVL6+vXKyqWs6tg/4A0qKmIXF2ufFowUmtkrJvtgiaZ4hWMLW1OoHJm6GDJ++/QjMS+MnOKg+zrjC5jAgCRvJ1eOF6ikDagEQluXKCH39bxXobmP/Tqh5DYgjU8nsg0F0tTuGVen9Zm65jZejUPobhEegw21jRwsHJRMZfAHb3DUS36ZM7C0SRJQzs+DVc8/xwBp8BH/0lxH0CgqvXBTkinGo5qRmCnuM+yhA2+anebQnxrTOU/vpLIIgjPG9rLy0WGg221B5V31anh0f34MnN+UcGo/YjaECgYEA6V8wn3Ii7JQEz1IjO38P5AS1ShU1iKkvQZB5j1TZmf563wtqiz1PEYwtkYN9BOuK9CaXQfdCe2STiP+ASUT6L4WyVbhqBSfufP8vP05UfoWhiGZrzcANAzCONwEcOqbmKVRfGFPIJZepZvntCleVVG53P/oKtwJ2npGP5AY3Gc8CgYEA0GNeb7+xH9BMo91bM48H/TE6TjywH3hIbQUZNafPJXFewL62Kw6ft0aDPVUpVp4eAwKK6pGK1O32Y4BHcVlx5/VX7ulFFw6foXiPwdqn7WjjfWrIuFzWfmGPNqjaSRzJ7h26fNMtJtkQguP+4leEXJqrez6UNTchqzwwf+cmzpMCgYEAj1D09EZMqkrwdT11A5mxcY9uofNKcAWuTq5h6KLsC0UbwhQptx7MivMyHNXKFhZsvCli5JDrVAndDNoTt2tT1ZFehoP9H/N442x3YIJDI3v/SlvTwoQ5uYa9H4xgAKj0WddFmxQAqw1rbCD58Er/Gt3IABMXN3Kc1B6CZj9m4UMCgYB5ULAkrFsoYzKK3w3+KRGElAkWjPwXhgXb+fDgLK5KZQK9gQk6bcwLfXBf31kuhOSB6hQHVO2W4mXjLUXqNiE64bjsbD79mlTSQwal226RptNxKx5pPhrc/lzKfGh/0dO43PO5QZNyn0Gega7cBAkZhC26lQbhKBRgxKyTeXU9IwKBgE/2Ta/fg4HAWyySHxT4dekPiZwceaFwBrrs1dwq7oNrSXsyOmzrDFeFek6pFYhbDsaX6JNH4NbQUrHLMxhUOqrtOd+b8Y4IXhnCbiaFua/LG8bfUGBC2RU9CpJN/BJGbOGs7KW1S8EwrmlWVlY+PCgoeh2GPdV1pe4tpWm90aJZ";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。

    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvfftaC1Fod0Pp6m4LzFFd5d7qSAGz2WofGHtYQTzvQ52yMXuWkB+FkbcIsAf/heR6Qq7TvZvY7nIlIvaz98SyuB9IBmyEVWyrArL6093gvB3piIZmdavid+AlsheH1WR9NzD0mElbIdbBUkVLcDOcJKu/1sGaZqb5gEqY4iyNdynaAafpsehR51mcCtYukowR02C827W4CS7nWwK3Z8ctsw6MbY3UvSJ7MF45Scm37lPSSif+rRzHsUWDBwAX2kIlnXY/RsL5aPB+bpPqTfiOawGfbXcS9pPIOmbwX/GQ/+tFZBmBji8cJQmig+D1JECBjTqlngM80gIhF8YhiJj3QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/pay.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

